home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-02-28 | 4.1 KB | 129 lines | [TEXT/R*ch] |
- London Calling, by Maurice Sharp
- Copyright (c) 1993-94 Apple Computer, Inc. All rights reserved.
-
- This sample shows how to get a modified phone number string based on
- the user settings in the Newt. It also shows how to bring up the Options
- dialog (as in the CallingSlip).
-
- The Sample
- ----------
-
- This section points you to the important parts of the London Calling sample.
- You may want to skip this section and read the System Calls and Data section
- first since it explains the mechanisms in detail.
-
- There are really only *** important parts to the sample...
-
- **** myBase.UpdatePhone - method ****
-
- This is where all the 'work' happens. It is a simple call to MungePhone
- embedded in a SetValue statement (so that the staticText that is the
- new phone number gets updated).
-
- **** myBase.countryList ****
-
- This is a protoTextList that is used to set the country of origin for
- the phone number in the phoneLine protoLabelInputLine.
-
- **** myBase.countryList.viewSetupFormScript / listItems ****
-
- the viewSetupFormScript sets up the listItems array used by protoTextList
- to construct the list of items (really...)
-
- It is set up by looking at ROM_countries (see below)
-
- **** Convert button ****
-
- This is actually a simple one. The buttonClickScript calls UpdatePhone
-
- **** Options button ****
-
- This is where I bring up the call options slip. The buttonClickScript
- does 2 things, first set the invoker slot of the callOptionsSlip, then
- toggles it. See below for more info on callOptionsSlip
-
-
- System Calls and Data
- ---------------------
-
-
- **** :MungePhone(<phone-string>, <origin-country>); ****
-
- This is the main method that you call to convert find the correct dialing
- sequence. It is a method of the root view (i.e., GetRoot()).
-
- RETURNS a string that is the phone number to dial based on the users
- location and other options (like long distance prefix, ...)
-
- <phone-string> is the phone number to convert. It should generally be of
- the form <area-code> <phone-number>
-
- e.g., 415 555 1212 - a phone number in San Fran
- 81 555 1212 - a phone number in London, UK
-
- <origin-country> a string that specifies the country of origin of
- the phone number in <phone-string>.
-
- e.g., "USA" for "415 555 1212"
- "UK" fo "81 555 1212"
-
- NOTE: the country MUST be one from ROM_countries (see below)
-
- Some examples for the inspector...
- Use the Newton to set your TimeZone to Cupertino
-
- GetRoot():MungePhone("408 555 1212", "USA");
- #441A751 " 555 1212"
-
- GetRoot():MungePhone("415 555 1212", "USA");
- #4410189 " 1 415 555 1212"
-
- GetRoot():MungePhone("81 555 1212", "UK");
- #440F8E1 " 011 44 81 555 1212"
-
- // Now go and set your TimeZone to London England
- GetRoot():MungePhone("408 555 1212", "USA");
- #440A7B9 " 010 1 408 555 1212"
-
- GetRoot():MungePhone("415 555 1212", "USA");
- #440AC41 " 010 1 415 555 1212"
-
- for fun you can try and set options in from the call slip (open up the
- cardfile and click on a telephone number, then click options). Check out
- how that modifies the return from MungePhone.
-
-
- **** ROM_countries ****
-
- This is a frame that has one slot for each country that Newton can
- convert phone numbers for. Each slot is a frame, the only slot you
- care about is the name slot.
-
- You can get an array of the names of all known countries like this:
-
- local countryNames := foreach item in ROM_countries collect item.name ;
-
-
- **** callOptionsSlip ****
-
- This is the sytem slip for getting and setting the user call options. This
- includes the current area code, dialing prefix, long distance access code and
- any calling card numbers the user may have.
-
- MungePhone automatically checks these user configuration items, so they will
- be figured into the return string.
-
- However, you may want to allow the user to set these up, so you will need to
- open the callOptionsSlip.
-
- This is actually very easy. You need to do 2 things:
-
- 1. Set the invoker slot in the callOptionsSlip to your application view
- 2. add an UpdatePhone method to your application view
-
- UpdatePhone()
-
- This method is called by callOptionSlip when it is closed or hidden.
- You should update whatever call string you have generated with another
- call to MungePhone.
-